import React, { FC, ReactElement, useState, useEffect, forwardRef } from 'react'
import SearchInput from '@/components/SearchInput'
import ClassCom from './ClassCom'
import SixTest from './SixTest'
import SevenTest from './SevenTest'
import useDidUpdateEffect from '@/hooks/useDidUpdateEffect'

const ActivityComment: FC = (): ReactElement => {
  const [searchValue, setSearchValue] = useState('')
  const [flag, setFlag] = useState(true)
  const [count, setCount] = useState(0)

  useDidUpdateEffect(() => {
    console.log('第二次执行result')
  })
  useEffect(() => {}, [])
  return (
    <div>
      评论活动
      <button
        onClick={() => {
          setFlag(pre => !pre)
        }}
        className="btn"
      >
        按钮{count}
      </button>
      {flag && (
        <SearchInput
          defaultValue="初始值"
          value={searchValue}
          onChange={(e: string) => {
            setSearchValue(e)
            console.log('传递的onchange', e)
          }}
        />
      )}
      <ClassCom />
      <SixTest />
      <SevenTest />
    </div>
  )
}
export default ActivityComment
